package com.hzit.mmcb.core.controller.api;


import com.hzit.common.result.R;
import com.hzit.mmb.base.utils.JwtUtils;
import com.hzit.mmcb.core.pojo.entity.TransFlow;
import com.hzit.mmcb.core.service.TransFlowService;
import org.apache.commons.collections4.list.TransformedList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 交易流水表 前端控制器
 * </p>
 *
 * @author ljh
 * @since 2024-08-27
 */
@RestController
@RequestMapping("/api/core/transFlow")
public class ApiTransFlowController {

    @Autowired
    private TransFlowService transFlowService;
    @GetMapping("/list")
    public R list(@RequestHeader("token") String token){
        Long userId = JwtUtils.getUserId(token);
        List<TransFlow> transFlows=transFlowService.findByUserId(userId);
        return R.ok().data("list",transFlows);
    }
}

